<?php
function getDb($connect = true)
{
	global $CONF;
	if(function_exists('mysqli_connect')){
		require_once('mysql/mysqli.class.php');
	}
	elseif (function_exists('mysql_connect')){
		require_once('mysql/mysql.class.php');
	}
	else{
		die("No extention for mysql or mysqli!");
	}
	$db =  new DbMySQL($CONF['sql_host'], $CONF['sql_user'], $CONF['sql_pwd'], $CONF['sql_db'],$CONF['sql_port']);
	$db->debug = $CONF['sql_debug'];
	$db->printErrMsg = $CONF['sql_print_error_sql'];
	if ($connect) {
		$db->connect();
	}
	return $db;
}
?>